<html>
<head>
    <include file="Common/top"/>
    <include file="Common/import_plugins"/>
    <link rel="stylesheet" href="/Public/Home/css/order_detial.css">
    <script src='http://app.lxh.magcloud.cc/public/static/dest/js/libs/magjs-x.js'></script>
</head>
<body>

<div class="total_price">
    <span class="text">订单总额</span>
    <span id="total_price">
        <span class="icon">￥</span>
        {$info.total_price}
    </span>
    <neq name="info['is_pay']" value="1">
        <button id="pay" class="layui-btn layui-btn-normal layui-btn-block">付款</button>
    </neq>
</div>
<div class="btn_return">
    <a href="{:U('Piaofutong/return_ticket',array('order_id'=>I('get.order_id')))}">申请退单</a>
</div>
<div class="btn_return">
    <a href="{:U('Order/index')}">查看订单</a>
</div>
<div class="box">
    <div class="title">
        {$info.s_name}
    </div>
    <volist name="list_sub_order" id="vo">
        <div>
            <div class="title ">
                {$vo.goods_name}
            </div>
            <table class="layui-table">
                <tr>
                    <td>使用日期</td>
                    <td>{$vo.playtime}</td>
                </tr>
                <tr>
                    <td>购买份数</td>
                    <td>￥{$vo.price} * {$vo.num}份</td>
                </tr>
            </table>
        </div>
    </volist>
    <table class="layui-table">
        <tr>
            <td>出行人</td>
            <td>{$info.real_name}</td>
        </tr>
        <tr>
            <td>身份证</td>
            <td>{$info.certificate_no}</td>
        </tr>
        <tr>
            <td>手机</td>
            <td>
                {$info.mobile}
            </td>
        </tr>
    </table>
</div>

<div class="box_info">
    <div class="title bg">
        取票信息
    </div>
    <table class="layui-table">
        <tr>
            <td>联系手机</td>
            <td>{$info.mobile}</td>
        </tr>
    </table>
</div>

<div class="box_info">
    <div class="title bg">
        订单信息
    </div>
    <table class="layui-table">
        <tr>
            <td>订单编号</td>
            <td>{$info.order_code}</td>
        </tr>
        <tr>
            <td>预订日期</td>
            <td>{:date('Y-m-d H:i:s',$info['playtime'])}</td>
        </tr>
        <tr>
            <td>支付方式</td>
            <td>在线支付</td>
        </tr>
    </table>
</div>
<script>
    $(function () {
        $('button#pay').click(function () {
            let ajax_url = '/index.php/Home/Order/verity_order_ajax/uniton_order_num/' + '{$info.union_order_num}';
            $.ajax({
                url: ajax_url,
                data: {},
                success: function (req) {
                    let code = req.paycode;
                    if (code === 1) {
                        alert(req.paymsg)
                    } else {
                        let url = '/index.php/Home/Order/verity_order/uniton_order_num/' + '{$info.union_order_num}';
                        let config = {
                            'money': '{$info.total_price}',
                            'title': '{$info.s_name}',
                            'des': '{$info.s_name}',
                            'payWay': {'alipay': 1, 'weixin': 1, 'wallet': 1},// 支付方式 支付宝 开启 ， 微信支付 开启 ， 账户余额 开启
                            'orderNum': '{$info.order_code}',
                            'unionOrderNum': '{$info.union_order_num}',
                            'type': '{$info.s_name}'
                        };

                        mag.pay(config, function () {
                            window.location.href = url;
                        }, function () {
                            // 支付失败回调
                        });
                    }
                }
            })
        })
    })
</script>
</body>
</html>
